﻿using UnityEngine;
using System.Collections;

public static class MonoExtensions
{
#if UNITY_EDITOR
    public static string GetFullName(this MonoBehaviour x)
    {
        return x.transform.GetFullName() + "." + x.GetType().Name + x.CompRank();
    }
    public static int CompRank(this MonoBehaviour x)
    {
        var lst = x.gameObject.GetComponents(x.GetType());
        for(int i = 0; i < lst.Length; i++)
        {
            if (lst[i] == x) return i;
        }
        throw new System.Exception();
    }
#endif
}